<#macro paginate currentPage totalPage actionUrl urlParas="">
	<#if (totalPage <= 0) || (currentPage > totalPage)><#return></#if>
	<#local startPage = currentPage - 4>
	<#if (startPage < 1)><#local startPage = 1></#if>
	
	<#local endPage = currentPage + 4>
	<#if (endPage > totalPage)><#local endPage = totalPage></#if>
			<#if (currentPage <= 8)>
				<#local startPage = 1>
			</#if>
			<#if ((totalPage - currentPage) < 8)>
				<#local endPage = totalPage>
			</#if>
			
			<#if (currentPage == 1)>
				<button class="btn btn-white" type="button"><i class="fa fa-chevron-left"></i></button>
			<#else>
				<button class="btn btn-white" type="button" onclick="location.href='${actionUrl}/#{currentPage - 1}${urlParas!}'"><i class="fa fa-chevron-left"></i></button>
			</#if>
			
			<#if (currentPage > 8)>
				<button class="btn btn-white" onclick="location.href='${actionUrl}/#{1}${urlParas!}'">#{1}</button>
				<button class="btn btn-white" onclick="location.href='${actionUrl}/#{2}${urlParas!}'">#{2}</button>
				<button class="btn btn-white">...</button>
			</#if>
			
			<#list startPage..endPage as i>
				<#if currentPage == i>
					<button class="btn btn-white  active">#{i}</button>
				<#else>
					<button class="btn btn-white" onclick="location.href='${actionUrl}/#{i}${urlParas!}'">#{i}</button>
				</#if>
			</#list>
			
			<#if ((totalPage - currentPage) >= 8)>
				<button class="btn btn-white">...</button>
				<button class="btn btn-white" onclick="location.href='${actionUrl}/#{totalPage - 1}${urlParas!}'">#{totalPage - 1}</button>
				<button class="btn btn-white" onclick="location.href='${actionUrl}/#{totalPage}${urlParas!}'">#{totalPage}</button>
			</#if>
			
			<#if (currentPage == totalPage)>
				<button class="btn btn-white" type="button"><i class="fa fa-chevron-right"></i> </button>
			<#else>
				<button class="btn btn-white" onclick="location.href='${actionUrl}/#{currentPage + 1}${urlParas!}'" type="button"><i class="fa fa-chevron-right"></i> </button>
			</#if>
</#macro>